package shplate

class FirstReportController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }

    def firstReport() {
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10, 20, 50, 100]

        params.SYS_QUERY_NAME = 'firstReport'
        def firstReport = dynamicQueryService.queryForList(params)
        def tableHeadList = []
        if (firstReport.size() > 0) {
            tableHeadList = firstReport[0].keySet()
        }
        params.SYS_QUERY_NAME = 'firstReportCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT

        /*params.SYS_QUERY_NAME = 'makeReportKhmc'
        def makeReportKhmc = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'makeReportQxsx'
        def makeReportQxsx = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'makeReportStepDesc'
        def makeReportStepDesc = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'makeReportDocState'
        def makeReportDocState = dynamicQueryService.queryForList(params)

        params.SYS_QUERY_NAME = 'makeReportFahuoState'
        def makeReportFahuoState = dynamicQueryService.queryForList(params)


        params.SYS_QUERY_NAME = 'makeReportPackageState'
        def makeReportPackageState = dynamicQueryService.queryForList(params)

        params.SYS_QUERY_NAME = 'makeReportStageDesc'
        def makeReportStageDesc = dynamicQueryService.queryForList(params)
        println(params.package1)*/
        [tableHeadList : tableHeadList, pageSizeList: pageSizeList, pageSize: pageSize, totalCount: totalCount, startno: params.startno ?: '', endno: params.endno ?: '',
         firstReport    : firstReport, ipn: params.ipn ?: '', caseNum: params.caseNum ?: '', ipn: params.ipn ?: '', stepDesc: params.stepDesc ?: '',
         pono          : params.pono ?: '', docId: params.docId ?: '', vpn: params.vpn ?: '', startTime: params.startTime ?: '', endTime: params.endTime ?: '',
         svpn          : params.svpn ?: '', kyh: params.kyh ?: '', state: params.state ?: '', khmc: params.khmc ?: '', qxsx: params.qxsx ?: '', sipn: params.sipn ?: '', fahuo: params.fahuo ?: '', package1: params.package1,
       stageDesc: params.stageDesc ?: '', startTime: params.startTime ?: '', endTime: params.endTime ?: ''
         /* ,makeReportIpn:makeReportIpn,makeReportDocId:makeReportDocId,makeReportSipn:makeReportSipn,makeReportVpn:makeReportVpn,makeReportKyh:makeReportKyh,makeReportPono:makeReportPono*/]
    }
}
